package com.cke.yang.storage.infra.enums;

import lombok.Getter;

/**
 *
 * @author yuyang
 */
@Getter
public enum FileTypeEnum {

    FILE("file", "文件"),
    DIRECTORY("directory", "目录");

    private final String code;
    private final String desc;

    FileTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static FileTypeEnum getByCode(String code) {
        if (code == null) {
            return null;
        }
        for (FileTypeEnum type : FileTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
